The present invention generally relates to methods and apparatuses that convert data, and more specifically, convert data from one ordinal type to another while loading/storing the data.
The electronic industry is in a state of evolution spurred by the unquenchable desire of the consumer for better, faster, smaller, and more functional electronic devices. In their attempt to satisfy these demands, the electronic industry must constantly strive to improve the speeds at which these desirable functions are performed.
Many of today""s electronic devices gather user interaction using components (e.g. joystick) that generate analog signals to represent the interaction process. The monitoring of these signals is typically accomplished using an Analog-to-Digital (A/D) converter which converts the received analog signals to integer representations. In more complex devices, there are often numerous such A/D converters each of which can provide differing formats for the integer representation (signed, unsigned, 8/16/32 bit etc . . . ). These integer representations are typically processed using some scaling factor in order to produce a desired result.
Current methodologies use software to convert and scale these integer representations into a desired format. Although software can perform the conversion and any necessary scaling, the time necessary to conduct such tasks is often cost prohibitive. It would, therefore, be a distinct advantage to have a method and apparatus that would scale and convert these integer representations into a desired format in a time efficient manner. The present invention provides such a method and apparatus.
The present invention is a method and apparatus that converts integer numbers into floating point representations while loading the data, and converts floating point numbers into integer representations while storing the data. The method and apparatus perform this conversion within a central processing unit having a converter unit and a set of conversion registers. Load instructions having integer data requiring conversion include an index field for identifying one of the conversion registers. Each one of the conversion registers includes information on the type of conversion required and any scaling factors to be applied. Upon receiving the data from memory, the converter uses the identified conversion register to convert the integer data into a floating point representation and saves this representation into the corresponding floating point register.
Store instructions having floating point data requiring conversion include an index field for identifying one of the conversion registers. Upon receiving the data from the floating point register, the converter uses the identified conversion register to convert the floating point data into an integer number and store the data into the corresponding memory location.